
	window._PageView = Backbone.View.extend({

        hide: function() {
            /*if ($(this.el).is(":visible") === false) {
                return null;
            }*/
            promise = $.Deferred(_.bind(function(dfd) { 
					if($(this.el).find(".page").get(0) == undefined){
						$(this.el).fadeOut('fast', dfd.resolve);
					}else{
						$(this.el).find(".page").fadeOut('fast', dfd.resolve);
						$(this.el).find(".actions").fadeOut('fast', dfd.resolve); 
					}
				}, this))
            return promise.promise();
        },

        show: function() {
            /*if ($(this.el).is(':visible')) {
                return;
            } */      
            promise = $.Deferred(_.bind(function(dfd) { 
					if($(this.el).find(".page").get(0) == undefined){
						$(this.el).fadeIn('fast', dfd.resolve);
					}else{
						$(this.el).find(".page").fadeIn('fast', dfd.resolve);
						$(this.el).find(".actions").fadeIn('fast', dfd.resolve); 
					}
				}, this))
            return promise.promise();
        },
		edit: function(id){  
			var tmpRouter=new Backbone.Router();
			tmpRouter.navigate(Backbone.history.fragment+"/edit",true);
			tmpRouter=null;
		},
		save: function(){  
			var tmpRouter=new Backbone.Router();
			var route = Backbone.history.fragment.substring(0,Backbone.history.fragment.lastIndexOf("/edit"));
			tmpRouter.navigate(route,true);
			tmpRouter=null;
		}

	}); 
